This changeset from the upstream mozilla-esr52 repository was adapted
to apply to icedove, by prepending "mozilla/" to the file names.

# HG changeset patch
# User Nicolas Silva <nsilva@mozilla.com>
# Date 1520858160 -3600
# Node ID c3e447e07077412b9cfaacb2ea91974655ed753b
# Parent  bb8ae7990f45dd295b80a347b779bcc4690205fa
Bug 1440717 - Use RefPtr for CompositingRenderTargetOGL::mGL. r=Bas, a=ritu

--- a/mozilla/gfx/layers/opengl/CompositingRenderTargetOGL.cpp
+++ b/mozilla/gfx/layers/opengl/CompositingRenderTargetOGL.cpp
@@ -55,17 +55,17 @@ CompositingRenderTargetOGL::BindRenderTa
         mGL->RenewSurface(mCompositor->GetWidget()->RealWidget());
         result = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
       }
       if (result != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
         nsAutoCString msg;
         msg.AppendPrintf("Framebuffer not complete -- CheckFramebufferStatus returned 0x%x, "
                          "GLContext=%p, IsOffscreen()=%d, mFBO=%d, aFBOTextureTarget=0x%x, "
                          "aRect.width=%d, aRect.height=%d",
-                         result, mGL, mGL->IsOffscreen(), mFBO, mInitParams.mFBOTextureTarget,
+                         result, mGL.get(), mGL->IsOffscreen(), mFBO, mInitParams.mFBOTextureTarget,
                          mInitParams.mSize.width, mInitParams.mSize.height);
         NS_WARNING(msg.get());
       }
     }
 
     needsClear = mClearOnBind;
   }
 
--- a/mozilla/gfx/layers/opengl/CompositingRenderTargetOGL.h
+++ b/mozilla/gfx/layers/opengl/CompositingRenderTargetOGL.h
@@ -179,17 +179,17 @@ private:
 
   InitParams mInitParams;
   /**
    * There is temporary a cycle between the compositor and the render target,
    * each having a strong ref to the other. The compositor's reference to
    * the target is always cleared at the end of a frame.
    */
   RefPtr<CompositorOGL> mCompositor;
-  GLContext* mGL;
+  RefPtr<GLContext> mGL;
   GLuint mTextureHandle;
   GLuint mFBO;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif /* MOZILLA_GFX_SURFACEOGL_H */

